package com.wx.chapter14.map_;

import java.util.*;

/**
 * @Author : 佩萁
 * Description :
 * @Create : 2023/8/3 - 17:38
 */
public class MapFor {
    public static void main(String[] args) {
        Map map = new HashMap();
        map.put("邓超", "孙俪");
        map.put("王宝强", "马蓉");
        map.put("宋喆", "马蓉");
        map.put("刘令博", null);
        map.put(null, "刘亦菲");
        map.put("鹿晗", "关晓彤");
        Set keySet = map.keySet();
        for (Object key : keySet) {
            System.out.println(map.get(key));
        }
        System.out.println("===========");
        Iterator iterator = keySet.iterator();
        while (iterator.hasNext()) {
            Object next = iterator.next();
            System.out.println(map.get(next));
        }
        System.out.println("===============");
        Collection values = map.values();
        for (Object value : values) {
            System.out.println(value);
        }

        System.out.println("================");
        Iterator iterator1 = values.iterator();
        while (iterator1.hasNext()) {
            Object next = iterator1.next();
            System.out.println(next);
        }
        System.out.println("==================");
        Set entrySet = map.entrySet();
        System.out.println(entrySet.getClass());
        for (Object entry : entrySet) {
            Map.Entry entry1 = (Map.Entry) entry;
        }
        Iterator iterator2 = entrySet.iterator();
        while (iterator2.hasNext()) {
            Object obj = iterator2.next();
            Map.Entry obj1 = (Map.Entry) obj;
            System.out.println(obj1.getValue());
        }
        Set set = map.entrySet();
        System.out.println(set.getClass());
        for (Object o : set) {
            System.out.println(o.getClass());
        }
    }
}
